package rabbitmq.listener;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.listener.api.ChannelAwareMessageListener;

/**
 * @Description
 * @Author shihan
 * @Date 2020/12/26 16:27
 * @Version 1.0
 */
public class MyMessageListener implements ChannelAwareMessageListener {

    @Override
    public void onMessage(Message message, Channel channel) throws Exception {
        System.out.println("接收到的消息是：" + new String(message.getBody(),message.getMessageProperties().getContentEncoding()));
    }
}
